import { AxiosRequestConfig } from 'axios';
import http from '@/utils/http';

// export async function Echoinfo(config?: AxiosRequestConfig<any>) {
//     const _config = <AxiosRequestConfig<any>>{
//         url: '/api/CarCategory/get/format', //上传车型的实拍图回显
//         method: 'GET',
//         ...config,
//     };
//     const response = await http.request(_config);
//     return response.data;
// }

export async function Echoinfo(id: number, config?: AxiosRequestConfig<any>) {
    const _config = <AxiosRequestConfig<any>>{
        url: `/api/CarCategory/get/format/${id}}`, // 上传车型的实拍图回显
        method: 'GET',
        ...config,
    };
    const response = await http.request(_config);
    return response.data;
}


export async function submitsp(config?: AxiosRequestConfig<any>) {
    const _config = <AxiosRequestConfig<any>>{
        url: '/api/CarCategory/upload/format', //上传车型的实拍图
        method: 'POST',
        ...config,
    };
    const response = await http.request(_config);
    return response.data;
}


export async function submits(config?: AxiosRequestConfig<any>) {
    const _config = <AxiosRequestConfig<any>>{
        url: '/api/CarCategory/upload/vmcarinfo', //上传虚拟车型
        method: 'POST',
        ...config,
    };
    const response = await http.request(_config);
    return response.data;
}


// export async function uploadFiles(config?: AxiosRequestConfig<any>) {
//     const _config = <AxiosRequestConfig<any>>{
//         url: '/api/life/common/uploadImageRussia',
//         method: 'POST',
//         ...config,
//     };
//     const response = await http.request(_config);
//     return response.data;
// }

export async function uploadFile(formData: FormData, config?: AxiosRequestConfig<any>) {
    const _config = {
        url: '/api/life/common/uploadImageRussia',
        method: 'POST',
        data: formData,
        headers: {
            'Content-Type': 'multipart/form-data'
        },
        ...config
    };
    const response = await http.request(_config);
    return response.data;
}
